From: Florian Müllner Date: Tue, 13 Jun 2017 03:39:06 +0000 (+0200) Subject: layout: Range-check index before array lookup X-Git-Tag: archive/raspbian/50.5-1+rpi1~1^2~1013^2^2~265 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=1ba014d9dba9b1884d7c889fb726eeeca6ff0634;p=gnome-shell.git layout: Range-check index before array lookup findMonitorForActor() may be called before the layoutManager gets to initialize monitors, so make sure the monitor index is in range to avoid a warning. https://bugzilla.gnome.org/show_bug.cgi?id=781471 --- diff --git a/js/ui/layout.js b/js/ui/layout.js index aaf9da536..b1e7f94b0 100644 --- a/js/ui/layout.js +++ b/js/ui/layout.js @@ -896,7 +896,10 @@ const LayoutManager = new Lang.Class({ }, findMonitorForActor: function(actor) { - return this.monitors[this.findIndexForActor(actor)]; + let index = this.findIndexForActor(actor); + if (index >= 0 && index < this.monitors.length) + return this.monitors[index]; + return null; }, _queueUpdateRegions: function() {